package cn.dy.sbo.model;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import cn.common.lib.springside.entity.AutoIdEntity;

/**
 * 物料在仓库内数量
 * @author mlv
 *
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MaterInWh extends AutoIdEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Materials		materials;
	
	private WareHouse		wareHouse;
	
	private float			onHand;	//库存中的实际数量

	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
	public Materials getMaterials() {
		return materials;
	}

	public void setMaterials(Materials materials) {
		this.materials = materials;
	}

	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
	public WareHouse getWareHouse() {
		return wareHouse;
	}

	public void setWareHouse(WareHouse wareHouse) {
		this.wareHouse = wareHouse;
	}

	public float getOnHand() {
		return onHand;
	}

	public void setOnHand(float onHand) {
		this.onHand = onHand;
	}
	
	
}
